<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /* ### 2.1 简易ATM

            - 题目描述：

            - 里面现存有  100 块钱。

            - 如果存钱，就用输入钱数加上先存的钱数, 之后弹出显示余额提示框

            - 如果取钱，就减去取的钱数，之后弹出显示余额提示框

            - 如果显示余额，就输出余额

            - 如果退出，弹出退出信息提示框

                操作界面如下 */
        let number = 0
        let money = 100;
        while (number != 4) {
            let number = parseInt(prompt("请输入您要的操作：" + "\n" + " 1. 存钱" + "\n" + " 2. 取钱" + "\n" + " 3. 显示" + "\n" + " 4. 退出"));

            if (number == 1) {
                money = money + parseInt(prompt("您输入您存入的金额："));
                alert("您的余额是" + money + "元");
            } else if (number == 2) {
                money = money - parseInt(prompt("您输入您取出的金额："));
                alert("您的余额是" + money + "元");
            } else if (number == 3) {
                alert("您的余额是" + money + "元");
            } else if (number == 4) {
                break;
            } else {
                alert("您输入的值已超出范围请重新输入！");
            }

        }
    </script>
</body>

</html>